import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
  logstatus:true,//判断登录状态
  vuexuid:'',//存放本地uid
  vuexusername:'',//存放用户账号
  vuexname:'',//存放用户名字
  vuexuserimgsrc:'',
  name:'你的名字'

  },
  getters: {

  },
  mutations: {

    //退出登录
    changefalse(state , v){

               state.logstatus=v

    },

    //登录状态
    changetrue(state){

              state.logstatus=true

    },
    
  //获取用户网名
  getvuexname(state,v){

              state.vuexname=v

  },

  //获取用户头像
getvuexuserimgsrc(state,v){
                state.vuexuserimgsrc=v
}

  },
  actions: {
video({commit}){
let name=localStorage.getItem('dw-anickname')
let img=localStorage.getItem('dw-avatar')
commit('getvuexname',name)
commit('getvuexuserimgsrc',img)

}

  },
  modules: {
  },
 plugins: [createPersistedState()]

})
